<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/header.css">
    <link rel="stylesheet" href="css/contain.css">
    <link rel="stylesheet" href="css/footer.css">
    <link rel="stylesheet" href="css/magnifying.css">
    <script src="js/jquery-1.12.4.js"></script>
    <!-- <script src="js/contains.js"></script> -->
    <script src="js/magnigying.js"></script>
    <script src="js/layer/layer.js"></script>
    <!-- <script src="js/jquery-1.8.0.min.js"></script> -->
</head>

<body>
    <div class="header1">
        <div class="header1-1">
            <ul class="header1-left">
                <li><a href="javascript:bookmark();"><em>&#9733</em>收藏本站</a></li>
                <li class="address">
                    <a href="#">送货至&nbsp安徽</a>
                    <ul>
                        <li class="clearfix"><span>A</span><a href="#">安徽</a></li>
                        <li class="clearfix"><span>B</span><a href="#">北京</a></li>
                        <li class="clearfix"><span>C</span><a href="#">重庆</a></li>
                        <li class="clearfix"><span>G</span><a href="#">广东</a>
                            <a href="#">广西</a>
                            <a href="#">贵州</a>
                            <a href="#">甘肃</a>
                        </li>
                        <li class="clearfix"><span>F</span><a href="#">福建</a></li>
                        <li class="clearfix"><span>H</span><a href="#">河北</a>
                            <a href="#">黑龙江</a>
                            <a href="#">海南</a>
                            <a href="#">湖北</a>
                            <a href="#">湖南</a>
                            <a href="#">河南</a>
                        </li>
                        <li class="clearfix"><span>J</span><a href="#">江苏</a>
                            <a href="#">吉林</a>
                            <a href="#">江西</a>
                        </li>
                        <li class="clearfix"><span>L</span><a href="#">辽林</a></li>
                        <li class="clearfix"><span>N</span><a href="#">内蒙古</a>
                            <a href="#">宁夏</a>
                        </li>
                        <li class="clearfix"><span>Q</span><a href="#">青海</a></li>
                        <li class="clearfix"><span>S</span><a href="#">上海</a>
                            <a href="#">山东</a>
                            <a href="#">山西</a>
                            <a href="#">四川</a>
                            <a href="#">陕西</a>
                        </li>
                        <li class="clearfix"><span>T</span><a href="#">天津</a></li>
                        <li class="clearfix"><span>X</span><a href="#">西藏</a>
                            <a href="#">新疆</a>
                        </li>
                        <li class="clearfix"><span>Y</span><a href="#">云南</a></li>
                        <li><span>Z</span><a href="#">浙江</a></li>
                    </ul>
                </li>
            </ul>
            <ul class="header1-right">
                <li id="Close"><a href="#">退出登录</a></li>
                <li><a href="/login.html">请登录</a></li>
                <li><a href="/register.html">注册</a></li>
                <li><a
                        href="http://passport.111.com.cn/sso/login.action?ReturnUrl=//my.111.com.cn/ucenter/orderList.action">我的订单</a>
                </li>
                <li class="my1yao">
                    <a href="https://my.111.com.cn/ucenter/myCenter.action">我的1药网</a>
                    <ul>
                        <li class="yao"><a href=""></a>我的优惠券</li>
                        <li class="yao"><a href=""></a>我的收藏夹</li>
                        <li class="yao"><a href=""></a>商品评价</li>
                        <li class="yao"><a href=""></a>我的私人定制</li>
                    </ul>
                </li>
                <li><a href="https://www.111.com.cn/errorpage.html">帮助中心</a></li>
                <li><a href="javascript:;">在线客服</a></li>
                <li>400-007-0958|</li>
                <li class="shouji"><a href="javascript:void(0)"><i><img src="images/手机.png" alt=""></i>&nbsp手机APP</a>
                    <ul>
                        <li class="FL"><img src="images/2wm.jpg" alt=""></li>
                        <li class="FL">
                            <p>1药网客户端</p>
                            <p class="app">APP专享价更优惠</p>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <div class="header2">
        <div class="header2-1">
            <div class="header2-t">
                <ul class="header2-t-left FL">
                    <li><img src="images/1药网_03.gif" alt=""></li>
                </ul>
                <ul class="header2-t-center FL">
                    <li class="soso"><input type="text" placeholder="请输入商品名，症状，人群等"><a href=""><img
                                src="images/1药网_09.gif" alt=""></a></li>
                    <li class="sodate">
                        <a href="111.com.cn/search/search.action?keyWord=%25E9%2598%25BF%25E8%2583%25B6">阿胶</a>
                        <a
                            href="https://www.111.com.cn/search/search.action?keyWord=%25E6%2584%259F%25E5%2586%2592">感冒</a>
                        <a
                            href="http://www.111.com.cn/search/search.action?keyWord=%25E9%2580%258D%25E9%2581%25A5%25E4%25B8%25B8">逍遥丸</a>
                        <a
                            href="http://www.111.com.cn/search/search.action?keyWord=%25E8%25A1%25A5%25E8%2582%25BA%25E4%25B8%25B8">补肺丸</a>
                        <a
                            href="http://www.111.com.cn/search/search.action?keyWord=%25E5%25A6%2587%25E7%2582%258E%25E6%25B4%2581">妇炎洁</a>
                        <a
                            href="http://www.111.com.cn/search/search.action?keyWord=%25E8%25A1%2580%25E5%258E%258B%25E8%25AE%25A1">血压计</a>
                        <a
                            href="http://www.111.com.cn/search/search.action?keyWord=%25E9%259A%2590%25E5%25BD%25A2%25E7%259C%25BC%25E9%2595%259C%25E6%258A%25A4%25E7%2590%2586%25E6%25B6%25B2">护理液</a>
                    </li>
                </ul>
                <ul class="header2-t-right FR">
                    <li class="FL"><img src="images/2wm.jpg" class="img1"> </li>

                    <li class="gouwu FR">
                        <p class="cece"><a href="https://buy.111.com.cn/cart/shoppingcart/queryshoppingcart.action"><img
                                    src="images/1药网_06.gif" class="img2"></a></p>
                        <ul class="gouwuce">
                            <li><img src="images/购物车-23.png" alt=""></li>
                            <li><span>您的购物车里还没有商品,</span> 如已添加商品,请 <span><a
                                        href="http://passport.111.com.cn/sso/login.action" class="longo">登录</a></span>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
            <div class="header2-L">
                <ul>
                    <li class="FL "><a href="https://www.111.com.cn/categories/">所有商品分类</a></li>
                    <li class="FL "><a href="http://127.0.0.1:8080/index.html">首页</a></li>
                    <li class="FL blue"><a href="https://www.111.com.cn/cmsPage/2015061908/index.html?tp=9-2">家庭常备药</a>
                    </li>
                    <li class="FL blue"><a
                            href="https://www.111.com.cn/cmsPage/20184ee7ab470926100714/index.html?tp=8-4&tp=9-3">乙肝</a>
                    </li>
                    <li class="FL "><a
                            href="https://www.111.com.cn/cmsPage/2017e7cbee3a1211161537/index.html?tp=9-4">传统滋补</a></li>
                    <li class="FL blue"><a href="111.com.cn/cmsPage/20188664d90f0514141253/index.html?tp=9-5">男性早泄</a>
                    </li>
                    <li class="FL blue"><a
                            href="https://www.111.com.cn/cmsPage/20181d6642160426113758/index.html?tp=9-6">控制三高</a></li>
                    <li class="FL "><a
                            href="https://www.111.com.cn/cmsPage/201732ed342b0118160705/index.html?tp=9-7">中药抓药</a></li>
                    <li class="FL blue"><a href="http://ir.111.com.cn/?tp=9-8">投资者关系</a></li>
                </ul>
            </div>
        </div>
    </div>
    <div class="contain1">
        <div class="contain1-1">
            <ul>
                <li class="FL"><a href=""><i><img src="images/首页-选中.png" alt=""></i> 首页</a><span>></span> </li>
                <li class="FL"><a href=""> 中西药品 </a><span>></span></li>
                <li class="FL"><a href=""> 心脑血管 </a><span>></span></li>
                <li class="FL"><a href="">冠心病 </a><span>></span></li>
                <li class="FL"><a href="">同溢堂 益安宁丸</a></li>
            </ul>
        </div>
    </div>
    <div class="contain2">
        <div class="contain2-1">
            <div class="contain2-2">
                <div class="contain2-left FL" id="box">
                    <div id="middleImg">
                        <img src="images/image/middle_1.jpg" />
                        <div id="smallArea"></div>
                    </div>
                    <div id="small">
                        <ul>
                            <li><img src="images/image/small_1.jpg" /></li>
                            <li><img src="images/image/small_2.jpg" /></li>
                            <li><img src="images/image/small-3.jpg" /></li>
                            <li><img src="images/image/small_4.jpg" /></li>
                            <li><img src="images/image/small_5.jpg" /></li>
                        </ul>
                    </div>
                    <div id="bigArea">
                        <img id="bigImg" src="images/image/big_1.jpg" />
                    </div>
                    <div class="fenxiang">
                        <ul>
                            <li class="FL">商品编码：1600797544</li>
                            <li class="FL"><a href=""><img src="images/五角星.png" alt=""></a></li>
                            <li class="FL"><a href="">收藏</a></li>
                            <li class="FL"><a href=""><img src="images/分 享2.png" alt="">分享</a></li>
                        </ul>
                    </div>
                </div>
                <div class="contain2-center FL">
                    <div class="prc"><span class="ziyin">自营</span><span><b>同溢堂 益安宁丸 112丸*3瓶</b></span></div>
                    <div class="prc">用于改善胸闷气短，畏寒肢冷，手足麻木等症状，对失眠健忘、神疲乏力、腰膝酸软也有一定疗效</div>
                    <div class="prc"><span>药网价:<em>￥790.00</em> </span><span>累计评论：<a href="">2205</a></span></div>
                    <div class="prc"><span>满城</span><a href="">买满¥790，减¥121元，更多优惠 立即参加 ></a></div>
                    <div class="prc">
                        <span>数量：</span>
                        <input type="text" value="1" id="inpu">
                        <a href="javascript:void(0)" class="num_pre"><img src="images/大于上.png" alt=""></a>
                        <a type="button" href="javascript:void(0)" class="num_next"><img src="images/大于下.png"
                                alt=""></a>
                    </div>
                    <div class="prc">
                        <img src="images/手机.png" alt="">
                        <span>手机扫扫更方便,</span>
                        <a href="">立刻扫码><img src="images/2w.jpg" alt=""></a>
                    </div>
                    <div class="prc">
                        <a href="#" class="add-one"><img src="images/cart.png" alt=""> 加入购物车</a>
                        <ul class="shope">
                            <li><span>1件商品加入购物车</span><span class="clo">X&nbsp</span></li>
                            <li>
                                <p class="FL" id="shope-p"><img src="images/image/middle_1.jpg" alt=""></p>
                                <ul class="FL" id="shope-c">
                                    <p>加入数量：1</p>
                                    <p>总计金额：<span>¥790.00</span></p>
                                    <p>
                                        <a href="">继续购物</a>
                                        <a href="">去结算</a>
                                    </p>
                                </ul>
                            </li>
                        </ul>
                    </div>
                    <div class="prc">
                        <p>本商品由1药网销售和发货</p>
                        <p>18:00前下单预计当天出库，部分城市支持次日达。<a href="">运费详情 >></a></p>
                        <p>
                            <a href=""><img src="images/99_03.gif" alt=""></a>
                            <a href="">100%正品</a>
                            <a href=""><img src="images/99_03.gif" alt=""></a>
                            <a href="">满69包邮</a>
                            <a href=""><img src="images/99_03.gif" alt=""></a>
                            <a href="">药监认证</a>
                            <a href=""><img src="images/99_05.gif" alt=""></a>
                            <a href="">不可使用优惠券</a>
                        </p>
                    </div>
                </div>
                <div class="contain2-right FR">
                    <ul>
                        <li>
                            <p><b>放心购买</b></p>
                            <p>
                                <a href="">互联网药品交易资格证:</a>
                                <a href="">粤C20150007</a>
                            </p>
                        </li>
                        <li>
                            <a href="">用1药网APP下单 享更多优惠</a>
                            <img src="images/2w.jpg" alt="">
                        </li>
                    </ul>
                </div>
            </div>
        </div>

    </div>
    <div class="contain3">
        <div class="contain3-1">
            <div class="contain3-left FL">
                <ul class="lei">
                    <li><b>相关分类</b></li>
                    <li>
                        <p>
                            <a href="">高血压</a>
                            <a href="">冠心病</a>
                            <a href="">冠心病</a>
                            <a href="">动脉硬化</a>
                            <a href="">静脉曲张</a>
                        </p>
                        <p>
                            <a href="">脑血管病</a>
                            <a href="">高血脂</a>
                            <a href="">心肌炎</a>
                            <a href="">心律失常</a>
                            <a href="">低血压</a>
                        </p>
                    </li>
                </ul>
                <ul class="lei">
                    <li><b>同类其他品牌</b></li>
                    <li>
                        <p>
                            <a href="">高血压</a>
                            <a href="">冠心病</a>
                            <a href="">冠心病</a>
                            <a href="">动脉硬化</a>
                            <a href="">静脉曲张</a>
                        </p>
                        <p>
                            <a href="">脑血管病</a>
                            <a href="">高血脂</a>
                            <a href="">心肌炎</a>
                            <a href="">心律失常</a>
                            <a href="">低血压</a>
                        </p>
                    </li>
                </ul>
                <span><b>浏览记录</b></span>
                <p><b>浏览了还浏览</b></p>
                <div class="look"><img src="images/左_03.gif" alt=""></div>
            </div>
            <div class="contain3-riht FR">
                <div class="contain3-righttop">
                    <p><a href="javascript:void(0)" class="hover1">商品行情 </a></p>
                    <p><a href="javascript:void(0)" class="hvoer2">商品评价（2005）</a></p>
                    <p><a href="javascript:void(0)" class="hover3">商品问答（12）</a></p>
                    <p><a href="javascript:void(0)" class="hover4">1药网介绍</a></p>
                </div>
                <div class="contain3-rightbottom">
                    <img src="images/评价1_03.gif" class="mag1">
                    <img src="images/评3_03.gif" class="mag2">
                    <img src="images/评4_03.gif" class="mag3">
                    <img src="images/评5_03.gif" class="mag4">
                </div>
            </div>
        </div>
    </div>
    <div class="footer1">
        <div class="footer1-1">
            <p><img src="images/6_03.gif" alt=""></p>
        </div>
    </div>
    <div class="footer2">
        <div class="footer2-1">
            <p><img src="images/7_03.gif" alt=""></p>
        </div>
    </div>
    <div class="footer3">
        <div class="footer3-1">
            <p class="FL"><img src="images/yyc_logo_icon.jpg" alt=""></p>
            <dl class="FL">
                <dt>新手入门</dt>
                <dd><a href="#">常见问题</a></dd>
                <dd><a href="#">新会员注册</a></dd>
                <dd><a href="#">用户登录</a></dd>
                <dd><a href="#">找回密码</a></dd>
            </dl>
            <dl class="FL">
                <dt>购物指南</dt>
                <dd><a href="#">购物流程</a></dd>
                <dd><a href="#">订单状态说明</a></dd>
                <dd><a href="#">隐私声明</a></dd>
                <dd><a href="#">发票制度</a></dd>
            </dl>
            <dl class="FL">
                <dt>配送服务</dt>
                <dd><a href="#">范围、时间及费用</a></dd>
                <dd><a href="#">商品验货及签收</a></dd>
                <dd><a href="#">门店自提</a></dd>
            </dl>
            <dl class="FL">
                <dt>支付方式</dt>
                <dd><a href="#">货到付款</a></dd>
                <dd><a href="#">网上支付</a></dd>
                <dd><a href="#">银行转账</a></dd>
                <dd><a href="#">激活优惠券</a></dd>
                <dd><a href="#">优惠券使用指南</a></dd>
            </dl>
            <dl class="FL">
                <dt>售后服务</dt>
                <dd><a href="#">退换货政策</a></dd>
                <dd><a href="#">退换货流程</a></dd>
                <dd><a href="#">退款方式和时效</a></dd>
                <dd><a href="#">售后常见问题</a></dd>
                <dd><a href="#">正品保障</a></dd>
                <dd><a href="#">品牌售后</a></dd>
            </dl>
            <dl class="FL">
                <dt>企业服务</dt>
                <dd><a href="#">供应商合作</a></dd>
                <dd><a href="#">供应商入口</a></dd>
                <dd><a href="#">商家入驻</a></dd>
            </dl>
        </div>
    </div>
    <div class="footer4">
        <div class="footer4-1">
            <div><img src="images/8_03.gif" alt=""></div>
            <ul class="clearfix">
                <li><a href="#">关于111集团&nbsp|</a></li>
                <li><a href="#">&nbsp关于1药网&nbsp|</a></li>
                <li><a href="#">&nbsp关于1药城&nbsp|</a></li>
                <li><a href="#">&nbspInvestor Relations&nbsp|</a></li>
                <li><a href="#">&nbsp诚聘英才&nbsp|</a></li>
                <li><a href="#">&nbsp直营实体药房</a></li>
            </ul>
            <ul class="clearfix">
                <li><a href="#">互联网药品信息服务资格证&nbsp|</a></li>
                <li><a href="#">&nbsp互联网药品交易资格证：粤C20150007&nbsp|</a></li>
                <li><a href="#">&nbsp连锁营业执照&nbsp|</a></li>
                <li><a href="#">&nbsp药品营业许可证&nbsp|</a></li>
                <li><a href="#">&nbsp医疗器械许可证</a></li>
            </ul>
            <ul class="clearfix">
                <li><a href="#">食品经营许可证&nbsp|</a></li>
                <li><a href="#">&nbspGSP证书&nbsp|</a></li>
                <li><a href="#">&nbspICP粤B2-20150066&nbsp|</a></li>
                <li><a href="#">&nbsp第二类医疗器械经营备案凭证&nbsp|</a></li>
                <li><a href="#">&nbsp医疗器械网络销售备案</a></li>
            </ul>
            <p>1药网网上药店，国家药监局认证通过的合法网上药店，中国医药电子商务行业的开拓者领跑者。粤ICP备12015869号-1</p>
            <p>公司名称：广东壹号大药房连锁有限公司 公司地址：广东省广州市越秀区共和西路1号2层 联系电话：020-31067218</p>
            <p>Copyright(C)2010-2019 1药网版权所有公安备案号 440104020000743</p>
            <ul class="ffooter">
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
                <li><a href="#"></a></li>
            </ul>
        </div>
    </div>
    <div class="itme">
        <div class="itmes">
            <div>
                <input type="text" class="tvalue">一件商品购物加入车
                <span><a href="">X</a></span>
            </div>
            <p id="itmes-img"><img></p>
            <p id="itmes-name">

            </p>
            <p id="itmes-num">加入数量：<input type="text" class="tvalue"></p>
            <p id="itmes-price">
                333
            </p>
            <p><a href="#" class="commback">继续购物</a></p>
            <p>
                <button class="add">去结算</button>
            </p>
        </div>

    </div>

</body>

</html>


<script>
    $(function () {
        show()
        function show() {
            if (!window.localStorage.getItem("currentUser")) {
                return
            }
            var gid = JSON.parse(window.localStorage.getItem("currentUser")).u_id;

            $.ajax({
                url: "/api/goods",
                data: {
                    uid: gid
                }
            }).then((res) => {
                console.log(res)
                var objItme = res[0];
                // console.log(objItme)

                $("#itmes-img").find("img").attr("src", objItme.gimgs1[0]);


                // objItme.gimgs2.forEach((el, index) => {
                //     $(".list-img").find("img").eq(index).attr("src", el)
                // })


                $("#itmes-name").text(objItme.gname);
                $("#itmes-price").text("价格$:" + objItme.gprice);

                //对象的深度拷贝
                var tmpObj = JSON.parse(JSON.stringify(objItme)); //
                delete(tmpObj.colors)
                delete(tmpObj.gimgs3)
                delete(tmpObj.gimgs2)
                tmpObj.gimgs1 = tmpObj.gimgs1[0];

                // console.log(tmpObj)

                $(".add").attr("data-info", JSON.stringify(tmpObj))

                $(".add")[0].info = tmpObj;
                // console.log($(".add")[0].info );

            })
            // console.log($(".add-one"));
        }


        $("body").on("click", ".add", function () {
            // console.log($(this).data("info")) //使用jq藏了值在标签上面
            //原生js藏的值在 dom对象上
            // console.log(this);
            // console.log(this.info);
            // console.log($(".add")[0].info );

            var saveObj = $(".add")[0].info;
            if (!window.localStorage.getItem("currentUser")) {
                layer.msg("请先登录");
                return
            }
            saveObj.uid = JSON.parse(window.localStorage.getItem("currentUser")).u_id;
            saveObj.num = $("#inpu").val() - 0;
            //发送ajax到后..后台做 有加入修改数量,没有就插入一条记录
            console.log(saveObj)
            $.ajax({
                url: "/api/addcart",
                type: "post",
                data: saveObj,
                success(res) {

                    if (res.status == 1) {
                        console.log(1)
                        layer.msg(res.msg);
                        window.location.href = "./cart.html"
                    }
                }
            })
        })
        $(document).on("click", ".commback", function () {
            $(".itme").hide();
        })
        $("#Close").on("click",()=>{
            localStorage.clear();
            layer.confirm("您确定要退出吗", {
                btn: ["记得回来"],
                    time: 2000, //20s后自动关闭
            });
       })
    })
</script>